// ============================== 导入依赖 ============================== //

import API from './API'
import API_MAP from '../API_MAP'

// ============================== 导出异步调用 ============================== //

export default {
  // —————————————————————————————— 改 —————————————————————————————— //

  async remoteEdit({ state: { one }, rootState: { param } }) {
    const msg = await API.edit({ ...one, id: param.idList })

    const multi = param.rowList.map((row) => {
      return API_MAP.mapDel({ deviceId: row.id, deviceCategoryId: row.deviceCategoryId })
    })
    await Promise.all(multi)

    return msg
  },
}
